// src/stores/authStore.js
import { defineStore } from 'pinia';

export const useAuthStore = defineStore('auth', {
  state: () => ({
    user: null, // 存储用户的登录信息
  }),
  actions: {
    login(user) {
      this.user = user;
    },
    logout() {
      this.user = null;
    },
  },
  getters: {
    getUsername: (state) => state.user?.username || 'Guest',
  },
});